package com.hcxy.filetransform.util;

import java.io.File;

import com.hcxy.filetransform.domain.FileTranslateInfo;

public class FileUtils {

	public static FileTranslateInfo getFileInfo(String path) {
		File file = new File(path);
		FileTranslateInfo finfo = null;
		if (file.exists()) {
			int index = path.lastIndexOf("\\");
			String name  = path.substring(index+1,path.length());
			String expandName = name.substring(name.lastIndexOf(".")+1,name.length());
			finfo =  new FileTranslateInfo();
			long size = file.length();
			finfo.setFilelength(size);
			finfo.setFileName(name);
			finfo.setExpandName(expandName);
			finfo.setToken(System.currentTimeMillis()+"");
		}
		return finfo;
	}

}
